﻿// Copyright 2007-2008 Rory Plaire (codekaizen@gmail.com)

using System;

namespace NPack.Interfaces
{
    /// <summary>
    /// Every class that has a + operation and an element
    /// such that <code>x + e = e + x = x</code> for all x should consider implementing this 
    /// interface. If T is a <see cref="ValueType"/>, e should be the default value. 
    /// </summary>
    /// <typeparam name="T">Type which has zero defined.</typeparam>
    /// <remarks>
    /// Adapted from an article on lambda-computing.com: 
    /// http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs.
    /// </remarks>
    public interface IHasZero<T> : IAddable<T>
    {
        /// <summary>
        /// Returns the additive identity.
        /// </summary>
        /// <value>e</value>
        T Zero { get; }
    }
}
